<template>
	<view>



	</view>
</template>

<script>
	import httpUtil from "@/utils/httpUtil";
	import commonApi from "@/api/commonApi";
	import userApi from "@/api/userApi";
	import backMiniApi from "../../api/backMiniApi";
	import logApi from "../../api/logApi";
	import paramApi from "../../api/paramApi";
	import {submitOrder} from "../../api/index.js";

	export default {
		data() {
			return {
				isVerify: false,
				userid:'',
				scrollTop: 0,
				imagePath: 'https://h5.sx2b2c.com/images/shengxin_tingche_mini/zfb/souhu_tingchequan/full_screen/',
				scrollToTargetId: "form-box",
				formData: {
					mobile: '',
					param: '',
					submit: 0,
					intervalId: '',
				}
			}
		},
		onLoad(option) {
			this.initData(option)
		
			
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		methods: {
			change(){
				submitOrder({
					a: httpUtil.getA(),
					user_id:uni.getStorageSync('users'),
					param: paramApi.getParam(),
					pro_code: 'QT3501'
				}).then((res) => {
					console.log(res.data.id)
			
						
						my.ap.openURL({
							url:'https://alipay.ink/ago?entrance=duanwaiqd_hy_cdqbkj_myb0001_myb6476_ywx_jcywx&spNo=34388&prodNo=34389&user_tag=' +res.data.id, // 请将 url 替换为有效的页面地址
							success: (res) => {
								console.log('openURL success', res)
							},
							fail: (err) => {
								console.log('openURL success', err)
							}
						});
					// let link = "https://render.alipay.com/p/s/i/?scheme=" + encodeURIComponent(
					// 		"alipays://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode="
					// 	) +
					// 	encodeURIComponent(encodeURIComponent(url))
					// my.ap.navigateToAlipayPage({
					// 	path: link
					// })
				})
			},
			initData(option) {
				// option.a = "123aaa"
				// option.param = "2"

				logApi.addLog('souhu_tcq_full option:' + JSON.stringify(option))
				paramApi.initData(option)

				backMiniApi.initBackMiniParam(option)
				// this.initParam(option)
				commonApi.is404()
				if (!uni.getStorageSync('users')) {
					my.getAuthCode({
						scopes: 'auth_base',
						success: (res) => {
							console.log(res)
							my.request({
								url: 'https://www.sx2b2c.com/api/rf/getAliUserid', // 请求的 URL
								method: 'POST', // POST 方法
								data: {
									code: res.authCode,
									pro_id: 51
								},
								header: {
									'Content-Type': 'application/x-www-form-urlencoded' // 设置请求头
								},
								success: (result) => {
									console.log(result)
								
										uni.setStorageSync('users',result.data.data.user_id)
									this.change()
								},
								fail: function() {
					
								}
							})
					
						},
					});
				}else{
					this.change()
				}

				if (option.submit) {
					this.formData.submit = option.submit
				}

				commonApi.isVerify(res => {
					this.isVerify = res
				})

				commonApi.buriedPoint(68)
				commonApi.newBuriedPoint('QT3501')
				let param = JSON.stringify({
					a: httpUtil.getA(),
					user_id: userApi.getUserId(),
					param: paramApi.getParam(),
					pro_code: 'QT3501'
				})
				
				logApi.addLog('mayibao option:' + param)
			},
			initParam(option) {
				if (option.a) {
					httpUtil.setA(option.a)
				}
				if (option.param) {
					userApi.setParam(option.param)
				}
			}
		}
	}
</script>

<style lang="scss">

</style>